package com.biye.api.controller.common;

import com.alibaba.fastjson.JSONObject;
import com.biye.api.service.UserInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

@Controller
@RequestMapping(value = "/common")
public class UserInfoChangeController {

    @Resource
    private UserInfoService userInfoService;

    // 修改个人信息
    @RequestMapping(value = "user_info", method = RequestMethod.PUT)
    @ResponseBody
    public JSONObject updateUserInfo(@RequestBody Map<String, Object> map){
        return userInfoService.updateUserInfo(map);
    }

    // 修改密码
    @RequestMapping(value = "user_pass", method = RequestMethod.PUT)
    @ResponseBody
    public JSONObject updateUserPassword(@RequestBody Map<String, Object> map){
        return userInfoService.updateUserPassword(map);
    }

    // 个人信息查询
    @RequestMapping(value = "user_info", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject queryPersonnelInfo(@RequestBody Map<String, Object> map){
        return userInfoService.queryUserInfo(map);
    }


}
